<?php

use yii\db\Migration;

/**
 * Handles the creation of table `project_investigation`.
 */
class m171030_054140_create_project_investigation_table extends Migration
{
    /**
     * @inheritdoc
     * 项目尽调报告-债权基本情况
     */
    public function up()
    {
        $this->createTable('project_investigation', [
            'id' => $this->bigPrimaryKey(),
            'project_id' => $this->bigInteger()->notNull(),
            'borrower' => $this->string()->notNull()->comment('借款人'),
            'guarantor' => $this->string()->notNull()->comment('保证人'),
            'mortgagor' => $this->string()->notNull()->comment('抵押人'),
            'mortgage_type' => $this->string()->notNull()->comment('抵押物类型'),
            'principal' => $this->string()->notNull()->comment('本金'),
            'interest' => $this->string()->notNull()->comment('利息'),
            'lawsuit' => $this->text()->comment('诉讼情况'),
            'execution' => $this->text()->comment('执行情况'),
            'auction' => $this->text()->comment('评估拍卖情况'),
            'records_investigation' => $this->text()->comment('案卷查询情况'),
            'records_consistence' => $this->text()->comment('案卷是否一致'),
            'order_sent' => $this->text()->comment('调解书/支付令是否送达'),
            'execution_method' => $this->text()->comment('执行终结方式'),
            'layer_interview' => $this->text()->comment('法官/律师访谈'),
            'debt_collection' => $this->text()->comment('未诉债权催收情况'),
            'prescription' => $this->text()->comment('时效结论'),
            'origin_files' => $this->text()->comment('证据是否有原件'),
            'conclusion' => $this->text()->comment('结论'),
            'created_at' => $this->timestamp(),
            'updated_at' => $this->timestamp(),
            'lock_user' => $this->integer()->comment('上锁用户'),
            'lock_timestamp' => $this->string()->comment('上锁时间'),
        ]);
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('project_investigation');
    }
}
